package com.common.www.repository.programme;

import org.springframework.boot.base.jpa.repository.support.ExtendedRepository;
import com.common.www.bean.entity.programme.ComparativeAnalysisRemark;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface ComparativeAnalysisRemarkRepository extends ExtendedRepository<ComparativeAnalysisRemark, Long> {

    /**
     * 根据类型\编码\名称 查找
     * @param keyHash
     * @return
     */
    @Query(value = "SELECT * FROM comparative_analysis_remark WHERE flag = 1 AND type = :type AND key_hash = :keyHash AND key_hash_name = :keyHashName ",nativeQuery = true)
    ComparativeAnalysisRemark getByTypeAndKeyHashAndKeyHashName(@Param("type") Integer type, @Param("keyHash") String keyHash,@Param("keyHashName") String keyHashName);


    /**
     * 根据编码查找
     * @param keyHash
     * @return
     */
    @Query(value = "SELECT * FROM comparative_analysis_remark WHERE flag = 1 AND type = :type AND key_hash = :keyHash ",nativeQuery = true)
    ComparativeAnalysisRemark getByTypeAndKeyHash(@Param("type") Integer type, @Param("keyHash") String keyHash);


}
